function alwaysFitDatePicker(){
	$('.form_date').css('display','block');
}
setTimeout(alwaysFitDatePicker,100);
var res = window.location.toString().split("#");
var lang = res[2];
if (lang == 'vn') {
	switch(res[1]) {
	    
		case "0":
	      {  
	        $("#restaurent").val("0_"+res[2]);
			$(".li_des").hide();$(".wmc_"+lang).show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng');
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "142":
	      {  
	        $("#restaurent").val("1_"+res[2]);
			$(".li_des").hide();$(".amigo_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_amigo_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Amigo');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }  	
		case "146":
	      {  
	        $("#restaurent").val("2_"+res[2]);
			$(".li_des").hide();$(".ccad_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccad_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại Café Central An Đông');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "147":
	      {  
	        $("#restaurent").val("3_"+res[2]);
			$(".li_des").hide();$(".ccnh_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccnh_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại Café Central Nguyễn Huệ');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "148":
	      {  
	        $("#restaurent").val("4_"+res[2]);
			$(".li_des").hide();$(".ducbao_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ducbao_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Đức Bảo');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "149":
	      {  
	        $("#restaurent").val("5_"+res[2]);
			$(".li_des").hide();$(".kissho_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_kissho_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Kissho');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "150":
	      {  
	        $("#restaurent").val("6_"+res[2]);
			$(".li_des").hide();$(".ngandinh_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_nd_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Ngân Đình');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').show();
			break;
		  } 	
		case "151":
	      {  
	        $("#restaurent").val("7_"+res[2]);
			$(".li_des").hide();$(".tott_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_tott_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Top of the Town');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "164":
	      {  
	        $("#restaurent").val("8_"+res[2]);
			$(".li_des").hide();$(".longtrieu_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_longtrieu_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Long Triều');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "171":
	      {  
	        $("#restaurent").val("9_"+res[2]);
			$(".li_des").hide();$(".thelong_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_thelong_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng The Long');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "194":
	      {  
	        $("#restaurent").val("10_"+res[2]);
			$(".li_des").hide();$(".randj_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_randj_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng R&J');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "206":
	      {  
	        $("#restaurent").val("11_"+res[2]);
			$(".li_des").hide();$(".cafecardinal_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_cafecardinal_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Cafe Cardinal');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		  
		default:
		  {
			$('.label_open_hours').hide();
			$('.wmc_outlet_nd_warning').hide();
		  }
		}
}else{
	switch(res[1]) {
	    
		case "0":
	      {  
	        $("#restaurent").val("0_"+res[2]);
			$(".li_des").hide();$(".wmc_"+lang).show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "142":
	      {  
	        $("#restaurent").val("1_"+res[2]);
			$(".li_des").hide();$(".amigo_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_amigo_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Amigo Grill Restaurant Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }  	
		case "146":
	      {  
	        $("#restaurent").val("2_"+res[2]);
			$(".li_des").hide();$(".ccad_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccad_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Café Central An Dong Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "147":
	      {  
	        $("#restaurent").val("3_"+res[2]);
			$(".li_des").hide();$(".ccnh_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccnh_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Café Central Nguyen Hue Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "148":
	      {  
	        $("#restaurent").val("4_"+res[2]);
			$(".li_des").hide();$(".ducbao_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ducbao_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Gartenstadt Restaurant Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "149":
	      {  
	        $("#restaurent").val("5_"+res[2]);
			$(".li_des").hide();$(".kissho_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_kissho_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Kissho Restaurant Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  } 
		case "150":
	      {  
	        $("#restaurent").val("6_"+res[2]);
			$(".li_des").hide();$(".ngandinh_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_nd_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Ngan Dinh Restaurant Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').show();
			break;
		  } 	
		case "151":
	      {  
	        $("#restaurent").val("7_"+res[2]);
			$(".li_des").hide();$(".tott_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_tott_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Top Of The Town Bar & Restaurant Reservation');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "164":
	      {  
	        $("#restaurent").val("8_"+res[2]);
			$(".li_des").hide();$(".longtrieu_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_longtrieu_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Long Triều Restaurant Reservations');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "171":
	      {  
	        $("#restaurent").val("9_"+res[2]);
			$(".li_des").hide();$(".thelong_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_thelong_open_hours").show("blind",1200);
 			$('h1.wmc_heading').html('The Long Restaurant Reservations');
 			$('.label_open_hours').show();
 			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "194":
	      {  
	        $("#restaurent").val("10_"+res[2]);
			$(".li_des").hide();$(".randj_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_randj_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('R&J Restaurant Reservations');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		case "206":
	      {  
	        $("#restaurent").val("11_"+res[2]);
			$(".li_des").hide();$(".cafecardinal_"+lang).show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_cafecardinal_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Cafe Cardinal Restaurant Reservations');
			$('.label_open_hours').show();
			$('.wmc_outlet_nd_warning').hide();
			break;
		  }
		  
		default:
		  {
			$('.label_open_hours').hide();
			$('.wmc_outlet_nd_warning').hide();
		  }
		}


} 


function validateEmail(email) { 
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	return re.test(email);
}

function isNumbermobile(evt,val)
 {
	if((val.length>11)&&(evt.which != 8)) return false;
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		{return false;}
	return true;
}

function checkEmail(email){
	
	if(!validateEmail(email)) 
	{
		$("#email").addClass("err");
	}
	else {
		$("#email").removeClass("err");
	}
	return true;
}

function checkPartySize(evt,val){
	
	var flag = isNumbermobile(evt,val);
	if(!flag) {$("#part_size").addClass("err"); return false;}
	else {
		$("#part_size").removeClass("err"); return true;
	}
}

function checkPhone(evt,val){
	
	var flag = isNumbermobile(evt,val);
	if(!flag) {$("#phone").addClass("err"); return false;}
	else {
		$("#phone").removeClass("err"); return true;
	}
}
function checkForm(){
	var res = window.location.toString().split("#");
	var lang = res[2];
	var flag = true;
	if(($("#restaurent").val() == "0_en") || ($("#restaurent").val() == "0_vn")) {
		$("#restaurent").addClass("err");
		flag = false;
	}else {
		$("#restaurent").removeClass("err");
	}
	
	if($("#f_name").val() == "") {
		$("#f_name").addClass("err");
		flag = false;
	}
	else {
		$("#f_name").removeClass("err");
	}
	
	if($("#l_name").val() == "") {
		$("#l_name").addClass("err");
		flag = false;
	}
	else {
		$("#l_name").removeClass("err");
	}
	
	if($("#phone").val() == "") {
		$("#phone").addClass("err");
		flag = false;
	}
	else {
		$("#phone").removeClass("err");
	}
	
	if($("#email").val() == "") {
		$("#email").addClass("err");
		flag = false;
	}
	else {
		$("#email").removeClass("err");
	}
	if($("#date").val() == "") {
		$("#date").addClass("err");
		flag = false;
	}
	else {
		$("#date").removeClass("err");
	}
	if($("#part_size").val() == "") {
		$("#part_size").addClass("err");
		flag = false;
	}
	else {
		$("#part_size").removeClass("err");
	}
	
	
	if(flag){
		$(".err_txt").hide();
		var click = $("#restaurent").children("option").filter(":selected").text();
		var res = window.location.toString();
		
		if(res.match('=vn') == '=vn' || res.match('=vi') == '=vi' || res.match('#vn') == '#vn' || res.match('#vi') == '#vi' || res.match('/vn') == '/vn' || res.match('/vi') == '/vi'){ 
			// ga('send', 'event', 'Restaurant Reservation Submit Button', click,' VN ');
			dataLayer.push({
		      'hitType': 'event',          // Required.
			  'eventCategory': 'Restaurant Reservation Submit Button',   // Required.
			  'eventAction': 'click',      // Required.
			  'eventLabel': 'VN',
			  'eventValue': ''
		 	});
		}else{
			// ga('send', 'event', 'Restaurant Reservation Submit Button', click,' EN ');
			dataLayer.push({
		      'hitType': 'event',          // Required.
			  'eventCategory': 'Restaurant Reservation Submit Button',   // Required.
			  'eventAction': 'click',      // Required.
			  'eventLabel': 'EN',
			  'eventValue': ''
		 	});
		}
		return true;
	}
	else {
		$(".err_txt").show();
	}
	return false;

}

function changeRestaurent(lang){
	
	
	//alert(lang);return false;
	var id;
	switch($("#restaurent").val()) {
		case "0_"+"en":
			$(".li_des").hide();$(".wmc_"+"en").show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.label_open_hours').hide();$('.wmc_outlet_nd_warning').hide();
			break;
		case "1_"+"en":
			$(".li_des").hide();$(".amigo_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_amigo_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Amigo Grill Restaurant Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "2_"+"en":
			$(".li_des").hide();$(".ccad_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccad_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Café Central An Dong Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "3_"+"en":
			$(".li_des").hide();$(".ccnh_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccnh_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Café Central Nguyen Hue Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;			
		case "4_"+"en":
			$(".li_des").hide();$(".ducbao_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ducbao_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Gartenstadt Restaurant Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "5_"+"en":
			$(".li_des").hide();$(".kissho_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_kissho_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Kissho Restaurant Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "6_"+"en":
			$(".li_des").hide();$(".ngandinh_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_nd_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Ngan Dinh Restaurant Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').show();
			break;
		case "7_"+"en":
			$(".li_des").hide();$(".tott_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_tott_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Top Of The Town Bar & Restaurant Reservation');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "8_"+"en":
			$(".li_des").hide();$(".longtrieu_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_longtrieu_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "9_"+"en":
			$(".li_des").hide();$(".thelong_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_thelong_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "10_"+"en":
			$(".li_des").hide();$(".randj_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_randj_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "11_"+"en":
			$(".li_des").hide();$(".cafecardinal_"+"en").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_cafecardinal_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Restaurant Reservations');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;

		case "0_"+"vn":
			$(".li_des").hide();$(".wmc_"+"vn").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng');
			$('.label_open_hours').hide();$('.wmc_outlet_nd_warning').hide();
			break;
		case "1_"+"vn":
			$(".li_des").hide();$(".amigo_"+"vn").show("blind",1200)
			;$(".open_hours").hide();$(".wmc_outlet_amigo_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Amigo');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "2_"+"vn":
			$(".li_des").hide();$(".ccad_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccad_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại Café Central An Đông');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;	
		case "3_"+"vn":
			$(".li_des").hide();$(".ccnh_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ccnh_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại Café Central Nguyễn Huệ');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;	
		case "4_"+"vn":
			$(".li_des").hide();$(".ducbao_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_ducbao_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Đức Bảo');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "5_"+"vn":
			$(".li_des").hide();$(".kissho_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_kissho_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Kissho');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "6_"+"vn":
			$(".li_des").hide();$(".ngandinh_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_nd_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Ngân Đình');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').show();
			break;
		case "7_"+"vn":
			$(".li_des").hide();$(".tott_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_tott_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Top of the Town');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "8_"+"vn":
			$(".li_des").hide();$(".longtrieu_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_longtrieu_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Long Triều');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "9_"+"vn":
			$(".li_des").hide();$(".thelong_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_thelong_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng The Long');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "10_"+"vn":
			$(".li_des").hide();$(".randj_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_randj_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng R&J');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
		case "11_"+"vn":
			$(".li_des").hide();$(".cafecardinal_"+"vn").show("blind",1200);
			$(".open_hours").hide();$(".wmc_outlet_cafecardinal_open_hours").show("blind",1200);
			$('h1.wmc_heading').html('Đặt chỗ tại nhà hàng Cafe Cardinal');
			$('.label_open_hours').show();$('.wmc_outlet_nd_warning').hide();
			break;
	}
	
	
}

